<?php
	include('conn.php');
	
	$custname = $_POST["cname"];
	$addrline1 = $_POST["addrline1"];	
	$addrline2 = $_POST["addrline2"];
	$addrline3 = $_POST["addrline3"];
	$city = $_POST["city"];
	$state = $_POST["state"];
	$country = $_POST["country"];
	$phone1 = $_POST["phone1"];
	$phone2 = $_POST["phone2"];
	$mobile1 = $_POST["mobile1"];
	$mobile2 = $_POST["mobile2"];
	$img = $_POST["logo"];
	$emailgen = $_POST["emailgen"];
	$logo = addslashes(file_get_contents($img));
	
	$sql = "insert into clientdetails values ('','$custname','$addrline1','$addrline2','$addrline3','$city','$state','$country','$phone1','$phone2','$mobile1','$mobile2','','','','$emailgen');";
	$result = mysql_query($sql);
				
	$sql2 = "update  clientdetails set logo = '$logo' where custname = '$custname';";  
	$result2 = mysql_query($sql2);
	
	if($result==1 && $result2==1)
		header('Location: /development/invoiceappdev/clientdetails_form.php');
	else
		echo "Error";
?>